<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>属性列表</title>
	<meta name="description" content="Static & Dynamic Tables" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<!-- basic styles -->
	<script type='text/javascript' src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/jquery-1.8.2.min.js'></script>
<link href='http://localhost/qm_shop/hdphp/hdphp/../hdjs/css/hdjs.css' rel='stylesheet' media='screen'>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/js/hdjs.js'></script>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/js/slide.js'></script>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/org/cal/lhgcalendar.min.js'></script>
<script type='text/javascript'>
		HOST = 'http://localhost';
		ROOT = 'http://localhost/qm_shop';
		WEB = 'http://localhost/qm_shop/index.php';
		URL = 'http://localhost/qm_shop/index.php/Admin/Attr/index/tid/10';
		HDPHP = 'http://localhost/qm_shop/hdphp/hdphp';
		HDPHPDATA = 'http://localhost/qm_shop/hdphp/hdphp/Data';
		HDPHPTPL = 'http://localhost/qm_shop/hdphp/hdphp/Lib/Tpl';
		HDPHPEXTEND = 'http://localhost/qm_shop/hdphp/hdphp/Extend';
		APP = 'http://localhost/qm_shop/index.php/Admin';
		CONTROL = 'http://localhost/qm_shop/index.php/Admin/Attr';
		METH = 'http://localhost/qm_shop/index.php/Admin/Attr/index';
		GROUP = 'http://localhost/qm_shop/./Qmshop';
		TPL = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl';
		CONTROLTPL = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Attr';
		STATIC = 'http://localhost/qm_shop/Static';
		PUBLIC = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public';
		HISTORY = 'http://localhost/qm_shop/index.php/Admin/Attr/add_attr/tid/10';
		HTTPREFERER = 'http://localhost/qm_shop/index.php/Admin/Attr/add_attr/tid/10';
</script>
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/common.css" rel="stylesheet" />
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/bootstrap.min.css" rel="stylesheet" />
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/font-awesome.min.css" />
	<!--[if IE 7]>
	  <link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/font-awesome-ie7.min.css" />
	<![endif]-->
	<!-- page specific plugin styles -->
	
	<!-- ace styles -->
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace.min.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-skins.min.css" />
	<!--[if lt IE 9]>
	  <link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-ie.min.css" />
	<![endif]-->
	<style type="text/css">
		select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
	    margin-bottom: 0px;
		}
	</style>
</head>
<body>

	<div class="container-fluid" id="main-container">
		<div class="table-header">
				类型管理 | <a style="font-size:14px;" href="<?php echo U('Type/index');?>">类型列表</a> > <a style="font-size:14px;" href="">属性列表</a>
		</div>
		<!-- PAGE CONTENT BEGINS HERE -->
		<div class="row-fluid">
			<div class="span12">
				<table id="table_bug_report" class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th class="center">
								<label><input type="checkbox" /><span class="lbl"></span></label>
							</th>
							<th>Aid</th>
							<th>属性名称</th>
							<th class="hidden-phone"><i class="icon-lemon hidden-phone"></i> 属性值</th>
							<th class="hidden-480">所属类型</th>
							<th style="width:125px;">操作</th>
						</tr>
					</thead>
											
					<tbody>
						<?php if(is_array($attr)):?><?php  foreach($attr as $value){ ?>
							<tr>
								<td class='center'>
									<label><input type='checkbox' /><span class="lbl"></span></label>
								</td>
								<td><?php echo $value['aid'];?></td>
								<td><a href='#'><?php echo $value['aname'];?></a></td>
								<td class='hidden-phone'>
									<span><?php echo $value['acontent'];?></span>
									<form action="<?php echo U('Attr/ajax_edit_attr');?>" onsubmit="return hd_submit(this,'http://localhost/qm_shop/index.php/Admin/Attr/index/tid/10')" style="margin:0px">
										<input type="hidden" name="aname" value="<?php echo $value['aname'];?>">
										<input type="text" name="acontent" value="<?php echo $value['acontent'];?>" style="display:none">
										<input type="hidden" name="aid" value="<?php echo $value['aid'];?>">
									</form>
								</td>
								<td class='hidden-480'><?php echo $value['qm_type_ttitle'];?></td>
								<td style="width:125px;">
									<div class='hidden-phone visible-desktop btn-group'>
										<a href="javascript:" class='btn btn-mini btn-success edit-attr'><i class='icon-edit'>修改</i></a>
										<a href="javascript:" class='btn btn-mini btn-danger' onclick="if(confirm('确定要删除吗？')) hd_ajax('<?php echo U('ajax_del_attr',array('aid'=>$value['aid']));?>')"><i class='icon-trash'>删除</i></a>
									</div>
								</td>
							</tr>
						<?php }?><?php endif;?>
					</tbody>
				</table>
				<a class="btn btn-primary btn-small" href="<?php echo U('add_attr',array('tid'=>$tid));?>"><i class="icon-pencil icon-white">添加属性</i></a>
			</div><!--/span-->
		</div><!--/row-->
		
		<!-- PAGE CONTENT ENDS HERE -->
				  
	</div><!-- #main-content -->
	

	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
		<i class="icon-double-angle-up icon-only"></i>
	</a>
	<!-- basic scripts -->
	
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/bootstrap.min.js"></script>
	<!-- page specific plugin scripts -->
	
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.dataTables.bootstrap.js"></script>
	<!-- ace scripts -->
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/ace-elements.min.js"></script>
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/ace.min.js"></script>
	<!-- inline scripts related to this page -->
	
	<script type="text/javascript">
	$(function() {
		var flag = false;
		$('.edit-attr').click(function() {
			var trObj = $(this).parent().parent().parent().find('td');
	        if(!flag){
	            trObj.find('input[type=text]').show();
	            trObj.find('span').hide();

	            $(this).removeClass('btn-success').addClass('btn-info').html("<i class='icon-check'> 保存</i>");
	            flag = true;
	        }else{
	           trObj.find('form').submit();
	        }
		});
		var oTable1 = $('#table_report').dataTable( {
		"aoColumns": [
	      { "bSortable": false },
	      null, null,null, null, null,
		  { "bSortable": false }
		] } );


		$('table th input:checkbox').on('click' , function(){
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
			.each(function(){
				this.checked = that.checked;
				$(this).closest('tr').toggleClass('selected');
			});
				
		});
		$('[data-rel=tooltip]').tooltip();
		})
	</script>
</body>
</html>